// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage

//testcase name：气表品牌信息修改
//author：feizhao
//date：2017-11-16
//discription：用于测试登陆后，气表品牌管理中修改气表品牌信息
//step：1.登录主页面  2.气表品牌管理  3.修改气表品牌信息  4.环境恢复
//修改人：
//修改日期：
//修改内容：

//Account setting.
const accountConfig = {
  username: '1',
  password: '1',
}
 module.exports = {
   'login tests': function (browser) {
     browser
     .url('http://127.0.0.1:8080').maximizeWindow()
     .pause(1000)
    //  .waitForElementVisible('body', 100)
     .setValue('input[type=text]',accountConfig.username)
     .pause(100)
     .setValue('input[type=password]',accountConfig.password)
     .pause(100)
     .click('button[id=login-button]')
     .pause(1000)
     .click('#vc-tree-name-综合业务')
     .pause(1000)
     .click('#vc-tree-name-气表品牌管理')
     .pause(1000)
//查找需要修改气表品牌
     .click('#f_meter_brand')
     .pause(300)
     .click('#f_meter_brand ul li:nth-child(1)')
     .pause(300)
     .setValue('input[placeholder=气表厂家]','GE')
     .pause(500)
     .click('#comprehen-gasBra-gasBraLis-查询')
     .pause(1000)
     .clearValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(1) :nth-child(2) input')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(1) :nth-child(2) input','GE物联网表')
     .pause(500)
     .click('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(1) :nth-child(4) div button')
     .pause(300)
     .click('#物联网表')
     .pause(500)
     .clearValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(1) :nth-child(6) input')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(1) :nth-child(6) input','GE')
     .pause(1000)
     .clearValue('#comprehen-gasBra-addGasBra-气表年限')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-气表年限','20')
     .pause(500)
     .clearValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(2) :nth-child(4) input')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(2) :nth-child(4) input','5000')
     .pause(500)
     .clearValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(2) :nth-child(6) input')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(2) :nth-child(6) input','100')
     .pause(1000)
     .clearValue('#comprehen-gasBra-addGasBra-别名')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-别名','GE')
     .pause(500)
     .clearValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(3) :nth-child(4) input')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(3) :nth-child(4) input','500')
     .pause(500)
     .clearValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(3) :nth-child(6) input')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-新增气表品牌 :nth-child(3) :nth-child(6) input','mima987654')
     .pause(1000)
     .clearValue('#comprehen-gasBra-addGasBra-校检年限')
     .pause(500)
     .setValue('#comprehen-gasBra-addGasBra-校检年限','5')
     //气表型号录入
     .pause(1000)
     .clearValue('input[placeholder=气表型号]')
     .pause(500)
     .setValue('input[placeholder=气表型号]','ge物联网表')
     .pause(500)
     .click('#comprehen-gasBra-addGasModIfo-表类型')
     .pause(500)
     .click('#家用皮膜表')
     .pause(500)
     .clearValue('input[placeholder=脉冲]')
     .pause(500)
     .setValue('input[placeholder=脉冲]','5')
     .pause(500)
     .clearValue('input[placeholder=额定流量]')
     .pause(500)
     .setValue('input[placeholder=额定流量]','50')
     .pause(500)
     .clearValue('input[placeholder=海力表型编码]')
     .pause(500)
     .setValue('input[placeholder=海力表型编码]','101')
     .pause(500)
     .click('#comprehen-gasBra-addGasModIfo-大小卡')
     .pause(300)
     .click('#小卡')
     .pause(500)
     .click('.panel.panel-default.auto.text-center img')
     .pause(500)
     .click('#comprehen-gasBra-addGasBra-修改')
//环境恢复
     //查询气表品牌
     .pause(1000)
     .click('#f_meter_brand')
     .pause(300)
     .click('#f_meter_brand ul li:nth-child(1)')
     .pause(300)
     .clearValue('input[placeholder=气表厂家]')
     .pause(500)
     .setValue('input[placeholder=气表厂家]','GE')
     .pause(500)
     .click('#comprehen-gasBra-gasBraLis-查询')
     //删除气表品牌
     .pause(1000)
     .click('#vc-datagrid-name-0 :nth-child(10) button')
     .pause(1000)
     .click('#vc-messagebox-confirm')
     .pause(3000)
     .end();
   }
 }
